from django.urls import path
from django.urls import path
from apps.users.views import UserCountView, RegisterView, MobileView, LoginView
from apps.users.views import LogoutView, UserCenterView
from apps.users.views import EmailView, EmailVerificationView, CreateAddressView
from apps.users.views import AddressListView, UpdateDestroyAddressView, DefaultAddressView
from apps.users.views import AddressTitleView, UpdatePwdView, UserHistoryView

urlpatterns = [
    path('usernames/<usercount:username>/count/', UserCountView.as_view()),
    # 注册
    path('register/', RegisterView.as_view()),
    path('mobile/<mobilecount:mobile>/count/', MobileView.as_view()),
    # 登录
    path('login/', LoginView.as_view()),

    # 退出
    path('logout/', LogoutView.as_view()),

    # 个人中心
    path('info/', UserCenterView.as_view()),

    # 邮箱
    path('emails/', EmailView.as_view()),

    # 验证邮箱
    path('emails/verification/', EmailVerificationView.as_view()),

    # 新增收货地址
    path('addresses/create/', CreateAddressView.as_view()),

    # 显示收货地址
    path('addresses/', AddressListView.as_view()),

    # 编辑收货地址
    path('addresses/<address_id>/', UpdateDestroyAddressView.as_view()),

    # 默认收货地址
    path('addresses/<address_id>/default/', DefaultAddressView.as_view()),

    # 修改地址标题
    path('addresses/<address_id>/title/', AddressTitleView.as_view()),

    # 修改密码
    path('password/', UpdatePwdView.as_view()),

    # 浏览记录
    path('browse_histories/', UserHistoryView.as_view()),
]
